CMAKE_MINIMUM_REQUIRED(VERSION 2.8)

PROJECT(RunTest)

SET(CMAKE_BUILD_TYPE "Debug")
SET(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb -L /lib64 -l pthread")
SET(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")
SET(Boost_USE_STATIC_RUNTIME OFF)
SET(CUKE_CORE_BOOST_LIBS thread system regex date_time program_options filesystem)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake" $ {CMAKE_MODULE_PATH})

IF(NOT CUKE_DISABLE_BOOST_TEST)
# "An external test runner utility is required to link with dynamic library" (Boost User's Guide)
    SET(Boost_USE_STATIC_LIBS OFF)
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_TEST_DYN_LINK")
    FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS unit_test_framework)
ENDIF()

IF(CUKE_USE_STATIC_BOOST)
    SET(Boost_USE_STATIC_LIBS ON)
    FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_CORE_BOOST_LIBS} REQUIRED)
    IF(NOT MSVC)
        FIND_PACKAGE(Threads)
        SET(CUKE_EXTRA_LIBRARIES ${CUKE_EXTRA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT})
    ENDIF()
ELSE()
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DBOOST_ALL_DYN_LINK")
    SET(Boost_USE_STATIC_LIBS OFF)
    FIND_PACKAGE(Boost ${BOOST_MIN_VERSION} COMPONENTS ${CUKE_CORE_BOOST_LIBS} REQUIRED)
ENDIF()

ADD_SUBDIRECTORY(c_style_tests)
ADD_SUBDIRECTORY(cpp_style_tests)
